package com.atgugu.springcloud.apis;


import com.atgugu.springcloud.entities.PayDTO;
import com.atgugu.springcloud.resp.ResultData;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
 * @author shiyi
 */

@FeignClient(value = "cloud-payment-service")
public interface PayFeignApi {

        @PostMapping("/pay/add")
        public ResultData addPay(@RequestBody PayDTO payDTO);

        @PostMapping("/pay/update")
        public ResultData updatePay(@RequestBody PayDTO payDTO);

        @PostMapping("/pay/del/{id}")
        public ResultData<Integer> deletePay(@PathVariable("id") Integer id);
/*
        @GetMapping("/pay/get/{id}")
        public  ResultData<PayDTO> getById(@PathVariable("id") Integer id);*/

        @PostMapping("/pay/getAll")
        public ResultData<List<PayDTO>> getAll();


        @GetMapping("/get/info")
        public String getInfoByConsul();


        // Resilience4j CircuitBreaker 的例子
        @GetMapping(value = "/pay/circuit/{id}")
        public String myCircuit(@PathVariable("id") Integer id);

        //Resilience4j Bulkhead 的例子
        @GetMapping(value = "/pay/bulkhead/{id}")
        public String myBulkhead(@PathVariable("id") Integer id);



        //GateWay进行网关测试案例01
        @GetMapping(value = "/pay/gateway/get/{id}")
        public ResultData getById(@PathVariable("id") Integer id);

        //GateWay进行网关测试案例02
        @GetMapping(value = "/pay/gateway/info")
        public ResultData<String> getGatewayInfo();



}
